package com.qhong.modules.entity;

import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import lombok.Data;
import lombok.ToString;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * Created by qhong on 2018/5/2 16:25
 **/
@Component
@Data
@ToString
public class HelloEntity {
    @Value("${app.count}")
    private int num;
    @Value("${app.name1:abcd}")
    private String name1;
    @Value("${app.name2:`abcd`}")
    private String name2;
    @Value("${app.name3}")
    private String name3;
    @Value("${app.enable}")
    private boolean appEnable;
    @Value("${app.name4:}")
    private String name4;
    @Value("${app.name5:''}")
    private String name5;
    @Value("${app.name6:@null}")
    private String name6;
    @Value("${app.name7:#{null}}")
    private String name7;
    @PostConstruct
    public void start() {
        System.out.println("start");
    }
    public void test(){
        System.out.println("num=" + num);
        System.out.println("appEnable=" + appEnable);
        System.out.println("name1=" + name1);
        System.out.println("name2=" + name2);
        System.out.println("name3 =" + name3);
        System.out.println("name4 =" + name4);
        System.out.println("name5 = " + name5);
        System.out.println("name6 = " + name6);
        System.out.println("name7 = " + name7);
    }
    @PreDestroy
    public void stop(){
        System.out.println("stop");
    }


    /**
     *没有限制，所有人都可访问的菜单
     */
    @Value("#{'${menu.unlimited}'.split(',')}")
    private List<String> unlimitedMenu;

    /**
     * 客户经理菜单
     */
    @Value("#{'${menu.customerManager}'.split(',')}")
    private List<String> customerManagerMenu;
}